home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
LIBRARY
/
RTPC10
/
JOKE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-11-20
|
4KB
|
87 lines
{
┌────────┬──────────────────────────────────────────────────────┐
│Name │ JOKE.PAS │
├────────┼──────────────────────────────────────────────────────┤
│Use │ Just an example program for TP6 and above. │
│ │ A TSR that prints HA! HA! every 10 seconds. │
├────────┼──────────────────────────────────────────────────────┤
│By │ Rafe Aldridge - (C) Copyright 1993 │
└────────┴──────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────┐
│ Please realise that this program present's an idea. No claim │
│ is made that it is well written or cannot be improved upon │
└───────────────────────────────────────────────────────────────┘
┌───────────────────────────────────────────────────────────────┐
│ Rafe's TP Collection is SHAREWARE │
├───────────────────────────────────────────────────────────────┤
│ │
│ If you find any part of Rafe's TP Collection usefull then │
│ please become a registered user by sending 10 Pounds Sterling │
│ to the address below. In return you will recieve the LATEST │
│ FULL source code to ALL the units as well anything new. │
│ │
│ Please feel free to write with suggestions, ideas or money to │
│ Rafe Aldridge, │
│ Street Farm, │
│ Dereham Road, │
│ Garvestone, │
│ Norfolk. │
│ NR9 4QT │
│ ENGLAND │
│ │
└───────────────────────────────────────────────────────────────┘
}
{ ---------------------------------------------------------------------- }
{ NOTES: }
{ o A TP interrupt proc disables interrupts. Hence the need for an STI. }
{ o An interrupt proc must not last more than 50mS. If it will last }
{ longer then a busy flag must be used to stop recursion. }
{ o In order to avoid an attempt to reenter DOS only use a DOS function }
{ when DOS is idle. I don't think that TP write uses a DOS function }
{ but I included the busy code to show how it is done. }
{ o TP initalizes the DS register in the interrupt proc. }
{ ---------------------------------------------------------------------- }
{$M 1024,0,0} { reserve stack memory }
{$R-,S-,D-,L-} { turn off stack checking etc. }
Uses DOS; { library for getintvec and setintvec }
Const DELAY_TIME = 182; { delay_time = 18.2 * number of seconds }
Var CNT : Word; { counter }
TIM_VEC : Pointer; { old timer routine }
DOS_SEG : Word; { segment and address for DOS BUSY flag }
DOS_BUSY : Word;
Procedure CLOCK; Interrupt;
Begin
Asm
PushF
Call DWord Ptr TIM_VEC { use built in assmblr to call old timer routine }
End;
If (CNT>DELAY_TIME) And (Mem[DOS_SEG:DOS_BUSY]=0) Then
Begin
Write (' HA! HA! ');
CNT:=0; { reset counter }
End;
Inc (CNT,1); { increment counter by 1 }
Asm
STI; { enable interrupts as TP proc turned em off }
End;
End;
Begin
GetIntVec (8,TIM_VEC); { get old vector }
SetIntVec (8,@CLOCK); { point vector to our routine }
Asm
Mov AH,$34 { get dos busy address }
Int $21
Mov DOS_SEG,ES
Mov DOS_BUSY,BX
End;
CNT:=0;
Keep(0);
End.